Getting Started
Install Dependency
First thing is to install huma package into the project. To do that, we can use npm
or yarn
package managers.
npm:
npm install @huma-engineering/auth
yarn:
yarn add @huma-engineering/auth
Project Setup
Once dependency installed we are able to use HumaAuthModule
to add authentication pages from the SDK.
AuthenticationModule
includes own routing rules, that are going to be used as part of the Angular router with pre-build authentication components.
In case if you would like to change the UI of the authentication but keet the same flow or API requests - you may skip importing the AuthenticationModule
router.
To provide proper auth configuration forRoot()
method should be used as folowing:
import { API_CONFIG } from '@huma-engineering/utils/api';
import { HumaAuthModule } from '@huma-engineering/auth';
...
@NgModule({
imports: [
HumaAuthModule,
RouterModule.forRoot([
{
path: 'auth',
loadChildren: () =>
import('huma-auth').then((m) => {
return m.AuthenticationModule;
}),
}
])
],
providers: [
{
provide: API_CONFIG,
useValue: {
hostUrl: 'https://devapi.humaapp.io',
clientId: 'c3',
projectId: 'p1',
},
}
]
})
export class AppModule {}
Configuration
All configuration fields are described by the AuthConfig
interface.
The most important fields are:
clientId
- provides client identifier to the backendprojectId
- provides project identifier to the backendhostUrl
- backend host url, used to build the enpdoints